//
//  PageViewMessageCell.swift
//  
//
//  Created by Ralf on 6/12/15.
//
//

import UIKit

class PageViewMessageCell: TableViewCell
{
    @IBOutlet var textView: UITextView!

    override func awakeFromNib()
    {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(selected: Bool, animated: Bool)
    {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

    func setData(data: NSDictionary)
    {
        let article = data["article"] as! NSDictionary

        let paragraphStyle = NSMutableParagraphStyle()

        paragraphStyle.lineHeightMultiple = 16
        paragraphStyle.maximumLineHeight = 20
        paragraphStyle.minimumLineHeight = 20

        paragraphStyle.alignment = .Left

        let attributes = [NSFontAttributeName: UIFont.systemFontOfSize(12),
                          NSParagraphStyleAttributeName: paragraphStyle,
                          NSForegroundColorAttributeName: UIColor.darkGrayColor()]

        textView.attributedText = NSAttributedString(string: article["message"] as! String, attributes: attributes)
    }
}
